#ifndef CARDBUTTON_H
#define CARDBUTTON_H
#include <QPushButton>
#include <QMouseEvent>
#include <QString>
#include <NavigationController.h>
#include <QIcon>
#include <QLabel>
#include <QGraphicsDropShadowEffect>
#include <QEvent>

/**
 * @brief The CardButton class
 * 主页按钮
 */
class CardButton : public QPushButton
{
    Q_OBJECT
public:
    CardButton(QString icon_path, QString label, Route destation);
private:
    QString icon_path;       // 图标路径
    QString label;          // 按钮标签
    Route destation;        // 路由目标

    QGraphicsDropShadowEffect * shadowEffect;

protected:
    void enterEvent(QEnterEvent *event) override {
        // 鼠标悬停时增加阴影效果
        shadowEffect->setBlurRadius(25);          // 增加模糊半径
        shadowEffect->setOffset(8, 8);            // 增加阴影偏移
        QPushButton::enterEvent(event);
    }

    void leaveEvent(QEvent *event) override {
        // 鼠标离开时恢复阴影效果
        shadowEffect->setBlurRadius(15);          // 恢复模糊半径
        shadowEffect->setOffset(6, 6);            // 恢复阴影偏移
        QPushButton::leaveEvent(event);
    }

private slots:
    void onButtonClicked();
};

#endif // CARDBUTTON_H
